<?php
namespace Framework;

class ErrorException extends \ErrorException
{

    public function __construct($message = '', $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, $previous = null)
    {
        if( $message == 'Division by zero' ){
            $message = '零不能被除! (original : Division by zero)';
        }

        if (substr($message, 0, 18) === 'Undefined variable') {
            $message = str_replace('Undefined variable', '未定义的变量', $message);
        }

        if (substr($message, 0, 25) === 'Use of undefined constant') {
            $message = str_replace('Use of undefined constant', '使用未定义的常量', $message);
        }

        // $message .= '\n <br> 是错误不是异常 in ErrorException';

        parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
    }
}